<?php
	$id=$_POST['id_jaminan'];
	
	$cek = mysql_num_rows(mysql_query("select j.id_jaminan from jaminan j inner join jaminan_ritl jr on j.id_jaminan = jr.id_jaminan where j.id_jaminan = '$id'"));
	echo $cek;
	if(isset($_POST['submit'])){
		if($cek > 0){
		
		}else{
			$tgl_mulai=tgl_ind2($_POST['tgl_mulai']);
			$tgl_selesai=tgl_ind2($_POST['tgl_selesai']);
			$jenis=$_POST['jenis'];
			$catatan=$_POST['catatan'];
			
			$sql="update jaminan set tgl_mulai = '$tgl_mulai', tgl_selesai = '$tgl_selesai', id_jenis_kunjungan = $jenis, id_catatan_kunjungan = $catatan where id_jaminan='$id'";
		}
		$qry=mysql_query($sql);
	}

	$url_sukses="utama.php?module=mod_jaminan";
	if($qry){
		echo "<meta http-equiv='refresh' content='0; url=$url_sukses'>";
		exit;
	}else{
		echo mysql_error();
	}
?>